#!/bin/bash
projname="demo"
serverdir=${projname}-server
#编译客户端
cd ${projname}-web
yarn install -d
yarn build --dest ../${serverdir}/dist
cd ..
#编译服务端
rm -rf -v release
mkdir -p release/${serverdir}
ls ${serverdir}|grep -v 'node_modules\|logs\|test'|xargs -i cp -r ${serverdir}/{} -v release/${serverdir}/
mv localdb release/
#打包未构建代码
cd release
tar --warning=no-file-changed -zcvf  release.tar.gz ${serverdir} ../cfgs
#构建egg服务端代码
cd ${serverdir}
yarn install --production
cd ..
#打包所有
tar --warning=no-file-changed -zcvf  update.tar.gz  ${serverdir} ../cfgs


